package fti.uksw.ruang.model;

import java.util.Date;

import android.os.Parcel;
import android.os.Parcelable;

public class RecurringDetail implements Parcelable {
	public final static String TAG = "recurringdetail";

	public final static String TABLE_NAME = "tbrecurring_detail";
	public final static String ID = "id";
	public final static String IDEVENT = "id_event";
	public final static String UNTIL = "until";
	public final static String TYPE = "type";
	public final static String INTERVAL = "interval";

	public final static String MODE_NOREPEAT = "No Repeat";
	public final static String MODE_DAILY = "Daily";
	public final static String MODE_WEEKLY = "Weekly";
	public final static String MODE_MONTHLY = "Monthly";

	private int id;
	private int idEvent;
	private Date until;
	private String type;
	private int interval;

	public RecurringDetail() {
	}

	public RecurringDetail(Parcel in) {
		readFromParcel(in);
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public int getIdEvent() {
		return idEvent;
	}

	public void setIdEvent(int idEvent) {
		this.idEvent = idEvent;
	}

	public int getInterval() {
		return interval;
	}

	public void setInterval(int interval) {
		this.interval = interval;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public Date getUntil() {
		return until;
	}

	public void setUntil(Date until) {
		this.until = until;
	}

	@Override
	public int describeContents() {
		return 0;
	}

	@Override
	public void writeToParcel(Parcel dest, int flags) {
		dest.writeInt(id);
		dest.writeInt(idEvent);
		dest.writeLong(until.getTime());
		dest.writeString(type);
		dest.writeInt(interval);
	}

	private void readFromParcel(Parcel in) {
		id = in.readInt();
		idEvent = in.readInt();
		until = new Date(in.readLong());
		type = in.readString();
		interval = in.readInt();
	}

	public static final Parcelable.Creator<RecurringDetail> CREATOR = new Parcelable.Creator<RecurringDetail>() {

		@Override
		public RecurringDetail createFromParcel(Parcel source) {
			return new RecurringDetail(source);
		}

		@Override
		public RecurringDetail[] newArray(int size) {
			return new RecurringDetail[size];
		}
	};
}
